#ifndef BROKENLINEWIG_H
#define BROKENLINEWIG_H

#include <QWidget>
#include <QDebug>
#include <QTimer>
#include <QFile>
#include <QDateTime>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <ctime>
#include <chrono>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <qmqtt_client.h>
#include "qcustomplot.h"
#include "globalval.h"
#include "mqtt/qmqtt.h"
namespace Ui {
class BrokenLineWig;
}

class BrokenLineWig : public QWidget
{
    Q_OBJECT

public:
    explicit BrokenLineWig(QWidget *parent = 0);
    ~BrokenLineWig();
    int key;  //唯一键值
    int type;  //数据点类型
    int result;//成功标志
    QString val;
    QString name;

    void setValue(const QString& name,const int& value);
    //设置qcustomplot画图属性，实时
    void setupRealtimeDataDemo(QCustomPlot *customPlot);
    time_t convertToTimestamp(const QString& dateTimeStr);

private slots:
   // void dataUpSlot(QByteArray payload);
    //添加实时数据槽
    void realtimeDataSlot();

    void on_onBtn_clicked();
    //void receiveHistoryData(int key, const QList<QPair<qint64, QString>>& historyData);


private:
    Ui::BrokenLineWig *ui;
    //定时器，周期调用realtimeDataSlot()槽，实现动态数据添加到曲线
    QTimer dataTimer;
};

#endif // BROKENLINEWIG_H
